<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:a="http://richfaces.org/a4j"
                template="template.xhtml">

    <!-- content -->
    <ui:define name="content">

        <div class="section">
            <h:form>
                <script type="text/javascript">
                //<![CDATA[
                function disableOnClick(lockingObject) {
                    lockingObject.onclick = function()  {
                        return false;
                    }
                }

                function enableOnComplete(lockingObject) {
                    lockingObject.onclick = function()  {
                        return true;
                    }
                }
                //]]>
                </script>
                <h2>#{messages['change_password_title']}</h2>
                <div class="messages"><h:messages infoClass="successBox"
                                                  warnClass="infoBox" errorClass="warningBox" fatalClass="errorBox"
                                                  globalOnly="true" showDetail="false" showSummary="true" />
                </div>
                <br />
                <table class="bodyTable detailPages">
                    <thead>
                        <tr>
                            <th class="field">#{messages['column_field_label']}</th>
                            <th class="value">#{messages['column_value_label']}</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="a">
                            <td class="field">
                                <h:outputText value="#{messages['change_password_old_password_label']}" />
                            </td>
                            <td class="value">
                                <h:inputSecret id="oldPassword" value="#{changePasswordPage.oldPasswd}" maxlength="15" size="20" 
                                               required="true"/>						
                                <a:outputPanel ajaxRendered="true">
                                    <h:message for="oldPassword" styleClass="warningBox inlineBox" />
                                </a:outputPanel>
                            </td>
                        </tr>
                        <tr class="b">
                            <td class="field">
                                <h:outputText value="#{messages['change_password_new_password1_label']}" />
                            </td>
                            <td class="value">
                                <h:inputSecret id="newPassword1" value="#{changePasswordPage.newPasswd}" maxlength="15" size="20" 
                                               required="true"/>						
                                <a:outputPanel ajaxRendered="true">
                                    <h:message for="newPassword1" styleClass="warningBox inlineBox" />
                                </a:outputPanel>
                            </td>
                        </tr>
                        <tr class="a">
                            <td class="field">
                                <h:outputText value="#{messages['change_password_new_password2_label']}" />
                            </td>
                            <td class="value">
                                <h:inputSecret id="newPassword2" value="#{changePasswordPage.newPasswdRepeat}" maxlength="15" size="20" 
                                               required="true"/>						
                                <a:outputPanel ajaxRendered="true">
                                    <h:message for="newPassword2" styleClass="warningBox inlineBox" />
                                </a:outputPanel>	
                            </td>
                        </tr>
                    </tbody>
                </table><br />
                <p>
                    <a:commandLink action="#{changePasswordPage.changePassword}" 
                                   id="change_link_button"
                                   status="gstat" eventsQueue="changePassword" ignoreDupResponces="true" 
                                   reRender="change_link_button" 
                                   onclick="disableOnClick(this)" 
                                   ondblclick="disableOnClick(this)" 
                                   oncomplete="enableOnComplete(this)"
                                   value="#{messages['change_password_action_change']}">
                    </a:commandLink>				
                </p>
            </h:form>
        </div>
    </ui:define>
</ui:composition>
